[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
strncmpi() Compare n Characters of Strings, Case Insensitive
#include <string.h> Required for declarations only
int strncmpi(str1,str2,n);
const char *string1; First string.
const char *string2; Second string.
size_t n; Number of characters compared.
strncmpi() is a macro implementation of strnicmp, which is in
turn a case-insensitive version of strncmp(); it compares a
maximum of 'n' characters of 'string1' to 'string2'. The strings
are compared lexicographically. Uppercase and lowercase forms of
a letter are considered equivalent.
Returns: A value indicating the relationship between the two
strings:
Comparison Returned
'string1' < 'string2' < 0
'string1' == 'string2' 0
'string1' > 'string2' > 0
Notes: strncmpi() expects to operate on null-terminated
strings. No overflow checking is done when strings
are copied or appended.
-------------------------------- Example ---------------------------------
The following statements compare 'n' characters of two strings. The
strings are equivalent.
#include <string.h>
#include <stdio.h>
char str1[20] = "eucalyptus trees";
char str2[20] = "Eucalyptus Trees";
int rslt;
main()
{
if((rslt = strncmpi(str1,str2,strlen(str1))) == 0)
printf("strings are equivalent");
else
printf("strings are not equivalent");
}
See Also:
strncmp()
strcmp()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson